home *** CD-ROM | disk | FTP | other *** search
- //////////////////////////////////////////////////////////////////////////////
- //
- // File: irc.mex
- //
- // Desc: Provides an IRC service for Maximus bbs users
- // Requires IRCDOOR/2 package
- //
- // Copyright 1996 by Andrew Eigus 2:5100/33@fidonet
- //
- //////////////////////////////////////////////////////////////////////////////
-
- #include <max.mh>
- #include <prm.mh>
- #include <max_menu.mh>
-
- #define DEMO_TIME 5L // define limited demo time
-
- long calc_time()
- {
- long: t;
-
- t := timeleft();
- // if (stridx(usr.xkeys, 1, 'I') = 0)
- // if (t > DEMO_TIME) t := DEMO_TIME; // restrict time
- return t;
- }
-
- int doirc(string: servername, int: tcpport)
- {
- long: time;
- string: command;
- int: exitcode;
-
- log(":IRC to " + servername);
-
- command := "irc.cmd " +
- uitostr(id.port) + " " + uitostr(id.task_num) +
- " -r\"" + usr.name + "\" -t" + ltostr(calc_time() * 60);
- if (servername <> "")
- command := command + " -s" + servername + " " + "-$" + uitostr(tcpport);
- exitcode := shell(IOUTSIDE_DOS, command);
- if (exitcode <> 0 AND exitcode <> 255)
- {
- if (exitcode = 1)
- print(COL_LRED, '\n', command, "\nCommand line syntax error. Please report to SysOp.");
- print("\n\n");
- menu_cmd(MNU_PRESS_ENTER, "");
- print('\n');
- }
- return 0;
- }
-
- void main()
- {
- char: ch;
- string: servername;
- int: len;
-
- ch := 1;
- display_file(prm_string(PRM_MISCPATH) + "doorsys2", ch);
- do {
- // now check if user is registered to use Telnet. If he has used all of his
- // demo time, piss him off.
- // if (stridx(usr.xkeys, 1, 'I') = 0)
- // {
- // if (timeon() > DEMO_TIME)
- // {
- // print(COL_LRED "\nSorry ", usr.name, ", but your demo access time for this session\n" +
- // "is over. You can only use first ", DEMO_TIME, " minutes for IRC ONCE logged\n" +
- // "on to the board.\n\n" +
- // "In order to have more time for IRC, please contact your SysOp.\n\n");
- // menu_cmd(MNU_PRESS_ENTER, "");
- // print('\n');
- // return;
- // }
- // }
-
- print("\n" COL_LCYAN "INTERNET RELAY CHAT");
- // if (stridx(usr.xkeys, 1, 'I') = 0)
- // print(COL_LRED "\n\nYou have demo IRC access limited to ",
- // calc_time(), " minutes. If you" +
- // " wish more time,\ncontact your SysOp\n\n");
- // else
- print(COL_CYAN " (" COL_LCYAN, calc_time(), COL_CYAN " min.)\n\n");
-
- print(COL_GRAY "Choose one of the IRC servers below to use for IRC,\n",
- "or press `", COL_WHITE "Q" COL_GRAY "' to quit to the main menu:\n\n");
-
- print(" " COL_LCYAN "1" COL_CYAN ") " COL_WHITE "irc.funet.fi [port 6666]\n");
- print(" " COL_LCYAN "2" COL_CYAN ") " COL_WHITE "irc.pspt.fi [port 6667]\n");
- print(" " COL_LCYAN "3" COL_CYAN ") " COL_WHITE "irc.nada.kth.se [port 6667]\n");
- print(" " COL_LCYAN "4" COL_CYAN ") " COL_WHITE "irc.epix.net [port 6667]\n");
- print(" " COL_LCYAN "5" COL_CYAN ") " COL_WHITE "uk.undernet.org [port 6667]\n");
- print(" " COL_YELLOW "*" COL_CYAN ") " COL_WHITE "custom...\n");
- ch := input_list("Q12345*?", CINPUT_FULLPROMPT OR CINPUT_ACCEPTABLE,
- "", COL_LRED "\nInvalid selection.\n", COL_GRAY "\nSelect:" COL_WHITE);
- print('\n');
- if (ch = '1')
- doirc("irc.funet.fi", 6666);
- else
- if (ch = '2')
- doirc("irc.pspt.fi", 6667);
- else
- if (ch = '3')
- doirc("irc.nada.kth.se", 6667);
- else
- if (ch = '4')
- doirc("irc.epix.net", 6667);
- else
- if (ch = '5')
- doirc("uk.undernet.org", 6667);
- else
- if (ch = '*')
- doirc("", 0);
- }
- while (ch <> 'Q');
- }